home *** CD-ROM | disk | FTP | other *** search
/ Creative Review 28 / Creative-Review-CD-ROM-28.iso / pc / kungfu / assets / game.dir / 00053_Script_video clip class < prev    next >
Text File  |  1997-08-08  |  4KB  |  199 lines

  1. -- video clip class method
  2. -- --------------------------------------------------
  3. property stay
  4. property in
  5. property out
  6.  
  7. property videonum
  8. property videoname
  9. property videofile
  10.  
  11. property platformseperator
  12. property folderpath
  13.  
  14. property rate
  15. property looped
  16.  
  17. property callbackflag
  18. property mode
  19. property channel
  20. property checkgap
  21. property updategap
  22. property checkearly
  23. property duration
  24. property draw
  25.  
  26. -- --------------------------------------------------
  27. global gtime, gcallback
  28.  
  29. -- ==================================================
  30. -- new method
  31. -- --------------------------------------------------
  32. on new me, props
  33.   
  34.   minit me, props
  35.   return me
  36.   
  37. end mnew 
  38.  
  39. -- ==================================================
  40. -- minit method
  41. -- --------------------------------------------------
  42. on minit me, props
  43.   
  44.   --  put "in minit video clip"
  45.   
  46.   list2object ( props,  me )
  47.   
  48.   set duration = out - in
  49.   set mode = #stop
  50.   set callbackflag = false
  51.   set checkgap = 1
  52.   set updategap = 0
  53.   set checkearly = 5
  54.   set stay = false
  55.   
  56.   if the machinetype = 256 then
  57.     set platformseperator = "\"
  58.   else 
  59.     set platformseperator = ":"
  60.   end if
  61.   
  62.   set folderpath =  "video" & platformseperator
  63.   
  64.   if voidp ( rate ) then set rate = true
  65.   
  66.   --  put "out minit video clip"
  67.   
  68. end minit
  69.  
  70. -- ==================================================
  71. -- mplay  method
  72. -- --------------------------------------------------
  73. on mplay me, checkhang
  74.   
  75.   --  put "in mplay video clip"
  76.   
  77.   set mode = #play
  78.   set callbackflag = true
  79.   
  80.   set stay = false
  81.   
  82.   set thefilepath = the moviepath & folderpath & videofile 
  83.   
  84.   if not ( the filename of cast ( the castname of draw )  = thefilepath ) then
  85.     set the filename of cast ( the castname of draw ) = thefilepath
  86.   end if
  87.   
  88.   --  put "--------------------"
  89.   --  put videofile
  90.   --  put thefilepath
  91.   --  put the filename of cast ( the castname of draw )
  92.   --  put "--------------------"
  93.   
  94.   mhide draw
  95.   
  96.   updatestage
  97.   
  98.   set channel = the channel of draw
  99.   set the movietime of sprite channel = in
  100.   
  101.   updatestage
  102.   
  103.   mdraw draw
  104.   
  105.   set the movierate of sprite channel = rate
  106.   
  107.   updatestage
  108.   
  109.   if checkhang then set nextupdate = the timer + 20
  110.   else set nextupdate = the timer + duration - checkearly
  111.   
  112.   maddtask gtime, me, nextupdate
  113.   
  114.   set updategap = checkgap
  115.   
  116.   --  put "out mplay video clip", videoname
  117.   
  118. end mplay
  119.  
  120. -- ==================================================
  121. -- mstop  method
  122. -- --------------------------------------------------
  123. on mstop me
  124.   
  125.   --  put "in mstop video clip"
  126.   
  127.   set mode = #stop
  128.   
  129.   set the movierate of sprite channel = false
  130.   
  131.   mhide draw
  132.   
  133.   set channel = 0
  134.   
  135.   mdeletetasks  gtime, me
  136.   
  137.   set updategap = 0
  138.   
  139.   if callbackflag then 
  140.     --    put "video clip stop callback"
  141.     mcallback (gcallback)
  142.   end if
  143.   
  144.   set callbackflag = false
  145.   
  146.   --  put "out mstop video clip", videoname
  147.   
  148. end mstop
  149.  
  150.  
  151. -- ==================================================
  152. -- mabort  method
  153. -- --------------------------------------------------
  154. on mabort me
  155.   
  156.   put "in mabort video clip", videoname
  157.   
  158.   set mode = #stop
  159.   
  160.   set the movierate of sprite channel = false
  161.   if not stay then set the castnum of me = 0
  162.   set channel = 0
  163.   
  164.   mdeletetasks  gtime, me
  165.   
  166.   set updategap = 0
  167.   
  168.   set callbackflag = false
  169.   
  170.   put "out mabort video clip", videoname
  171.   
  172. end mabort
  173.  
  174. -- ==================================================
  175. -- mdotask method
  176. -- --------------------------------------------------
  177. on mdotask me
  178.   
  179.   --  put "in mdotask video clip"
  180.   
  181.   --  put the movietime of sprite channel, in, out
  182.   --  put "rate: " , the movierate of sprite channel
  183.   
  184.   if the movietime of sprite channel >= out then
  185.     if mode = #play then mstop me
  186.     return false
  187.   end if
  188.   
  189.   if not ( the movierate of sprite channel = rate ) then
  190.     set the movierate of sprite channel = rate
  191.     put "******* video hung and restarted *******"
  192.   end if
  193.   
  194.   --  put "out mdotask video clip"
  195.   
  196.   return updategap
  197.   
  198. end mdotask
  199. -- --------------------------------------------------